<?php
namespace app\admin\controller;
class PayLog extends Common
{
	public function index()
	{
		if(request()->isPost()){
            $key=input('post.key');
            $page =input('page')?input('page'):1;
            $pageSize =input('limit')?input('limit'):config('pageSize');
            $list=db('paylog')->alias('u')
                ->join(config('database.prefix').'users ul','u.m_id = ul.id','left')
                ->field('u.*,ul.username')
                ->where('u.id|ul.username','like',"%".$key."%")
                ->order('u.id desc')
                ->paginate(array('list_rows'=>$pageSize,'page'=>$page))
                ->toArray();
            return $result = ['code'=>0,'msg'=>'获取成功!','data'=>$list['data'],'count'=>$list['total'],'rel'=>1];
        }
        return $this->fetch();
	} 
 
	
	public function del()
	{
        $id = input('id');
        if (empty($id)){
            return ['code'=>0,'msg'=>'种类ID不存在！'];
        }
        db('pay_log')->where(array('id'=>$id))->delete();
        return ['code'=>1,'msg'=>'删除成功！'];
    }

    
}